package bilibili.poly_.shuzu;

public class PolyShuzu {
    public static void main(String[] args) {
        // 定义父类数组
        Person[] person = new Person[5];

        // 将1个Person对象、2个Student对象和2个Teacher放入父类数组
        person[0] = new Person("zhangsan", 20);
        person[1] = new Student("lisi", 20, 90);
        person[2] = new Student("wangwu", 20, 91);
        person[3] = new Teacher("tom", 30, 20000);
        person[4] = new Teacher("jack", 35, 25000);

        // 循环遍历，调用say方法
        for (int i = 0; i < person.length; i++) {
            System.out.println(person[i].say());
        }
    }
}
